
<%@ page language="java" errorPage="/CustomError.jsp"
	pageEncoding="UTF-8"%>
<%
	request.getRequestDispatcher("/jsp/BaseInclude.jsp").include(
			request, response);
%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>Register</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
		<%
			String sessionId = session.getId();
		%>

		<script type="text/javascript" language="javascript"
			src="<%=path%>/include/lib/jquery.js"></script>
		<script type="text/javascript" language="javascript"
			src="<%=path%>/include/lib/curvycorners.js"></script>
		<script type="text/javascript" language="javascript"
			src="<%=path%>/include/lib/link.js"></script>
		<script type="text/javascript"
			src="<%=request.getContextPath()%>/include/lib/md5.js">
     chrsz = 16;
   </script>
		<script type='text/javascript' src='<%=path%>/include/lib/utils.js'></script>

		<script type='text/javascript'>
	
		function showTxtBox(){
		
			
			document.getElementById('adminId').style.visibility='hidden';
			document.getElementById('adminID').style.visibility='hidden';
			
		}
		
		function dis(){
		
		document.getElementById('adminId').style.visibility='hidden';
		}
		
		window.onload = function dis(){
				alert("window");		
		}
		</script>
		
		
		<script type='text/javascript' >
	function submitForm(){
	
	
		  var loginId = document.all.loginId.value;
		 
		  var pwd = document.all.uipassword.value;
		 
		  if ( null == loginId || loginId == "" )
		  {
			   
		  	window.alert("User Id cannot be blank");
		  	document.all.loginid.focus();
		  	
		  	return false;
		  }
		  
		  if (null == pwd || pwd == "")
		  {
		  
		 		 window.alert("Password cannot be blank");
		 		 document.all.uipassword.focus();
		  	return false;
		  }       
		                     
		  
		
		/////password validation
		var invalid = " "; // Invalid character is a space
		var minLength = 6; // Minimum length
		var pw1 = document.all.uipassword.value;
		var pw2 = document.all.uirepassword.value;
		// check for a value in both fields.
		if (pw1 == '' || pw2 == '') {
		alert('Please enter your password twice.');
		return false;
		}
		// check for minimum length
		if (document.all.uipassword.value.length < minLength) {
		alert('Your password must be at least ' + minLength + ' characters long. Try again.');
		return false;
		}
		// check for spaces
		if (document.all.uipassword.value.indexOf(invalid) > -1) {
		alert("Sorry, spaces are not allowed.");
		return false;
		}
		else {
		alert(pw1 );
		alert(pw2 );
		
		if (pw1 != pw2) {
			alert ("You did not enter the same new password twice. Please re-enter your password.");
			return false;
		}
				else {
				alert('Password validated.');
				return true;
		      	}
   		}
   	
   	
   	//// end here
		document.all.password.value = hex_md5(pwd);
		
		//Need to make uipassword empty
		document.all.uipassword.value = "";
		
	return true;
	  
	
	}
	
	
	
	</script>

	</head>

	<body onload="dis()">
		<html:html>
		<html:form action="/register" 	onsubmit="return submitForm()">
			<div id="main">
				<jsp:include page="Logo.jsp"></jsp:include><div id="top-blue-line"></div>
			</div>
			<div id="main">
				<div id="margin-top">
					<div id="content">
						<div id="wid-228">
							<div id="myBox-reg">
								<div class="pad-left">
									<span class="blue-bold"><bean:message key="register" />
									</span>
								</div>
								<div class="pad-left">
									<span class="bold-11"><bean:message key="userName" />
									</span>
									<br />
									<html:text property="userName" alt="Enter UserName"
										styleClass="field-login" maxlength="25" />
								</div>
								<div class="pad-left">
									<span class="bold-11"><bean:message key="userid" />
									</span>
									<br />
									<html:text property="loginId" alt="Enter LoginID"
										styleClass="field-login" maxlength="25" />
								</div>
								<div class="pad-left">
									<span class="bold-11"><bean:message key="password" />
									</span>
									<br />
									<input type="password" name="uipassword" maxlength=12
										alt="Enter password" class="field-login"
										onKeyDown="return DisableCtrlKey(event)" maxlength="50" />
									<html:hidden property="password" value="" />
								</div>

								<div class="pad-left">
									<span class="bold-11"><bean:message key="repassword" />
									</span>
									<br />
									<input type="password" name="uirepassword" maxlength=12
										alt="Enter password" class="field-login"
										onKeyDown="return DisableCtrlKey(event)" maxlength="50" />
								</div>

								<div class="pad-left">
									<span class="bold-11"><bean:message key="emailid" />
									</span>
									<br />
									<input type="text" name="emailId">
								</div>

								<div class="pad-left">
									<span class="bold-11"><bean:message key="isAdmin" />
									</span>
									<br />
									<input name="Input" id="Input" type="checkbox"  />
								</div>
								<div class="pad-left">
									<span class="bold-11"><bean:message key="adminID" />
									</span>
									<br />
									<input type="text" name="adminId" value="" />
									<br>
									<br>
								</div>
								&nbsp; &nbsp; &nbsp;&nbsp;
								<html:submit property="submit" styleClass="submit"
									style="cursor:pointer">
								</html:submit>


							</div>

						</div>
						<div class="welcome">
							&nbsp;Welcome to your Registration!
							<br />
							<br />
							<br />
							<img src="<%=path%>/images/Register.jpg" width="383" height="285" />
							<br />
							<br />
						</div>
					</div>
				</div>
			</div>
		</html:form>

		</html:html>

	</body>
</html>
